﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using hbse.Entities;
using NHibernate;

namespace hbse
{
    public partial class Form1 : BaseForm
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            using (Session.BeginTransaction())
            {
                var albums = Session.CreateQuery("from Album ").Future<Album>();
                dgv1.DataSource = albums.ToList();
              
            }


        }

        private void button2_Click(object sender, EventArgs e)
        {
            Album a = new Album();
            a.Title = "testttt";

            using (ITransaction tx = Session.BeginTransaction())
            {
                Session.Save(a);
                Session.Flush();
                tx.Commit();
            }
            Close();
        }
    }
}
